package edu.nf.api.controller.shop;

import edu.nf.api.controller.BaseController;
import edu.nf.waimai.model.shop.ShopType;
import edu.nf.waimai.service.shop.ShopTypeService;
import edu.nf.waimai.service.shop.impl.ShopTypeServiceImpl;
import org.nf.web.annotation.Model;
import org.nf.web.annotation.RequestMapping;
import org.nf.web.annotation.RequestParam;
import org.nf.web.servlet.View;
import org.nf.web.servlet.view.JsonView;



public class ShopTypeController extends BaseController {
    private ShopTypeService service = new ShopTypeServiceImpl();

    /**
     * 添加商家类型
     * @param shopType
     * @return
     */
    @RequestMapping("/shopType/addShopType")
    public View addShopType(@Model ShopType shopType){
        return new JsonView(success(service.addShopType(shopType)));
    }

    /**
     * 通过id删除商家
     * @param shopTypeId
     * @return
     */
    @RequestMapping("/shop/shopType/delShopType")
    public View delShopType(@RequestParam("shopTypeId") int shopTypeId){
        return new JsonView(success(service.delShopType(shopTypeId)));
    }

    /**
     * 查询全部店铺类型
     * @return
     */
    @RequestMapping("/shop/shopType/getShopTypeList")
    public View listShopList(){
        return new JsonView(success(service.listShopType()));
    }
}
